﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Sistema.Dominio;

namespace Sistema.WF.Componentes.UserControls
{
    public partial class R2Email : UserControl
    {
        public R2Email()
        {
            InitializeComponent();
        }



#region Get's and Set's
        public EmailVO Email
        {
            get { return RecolheDadosTela(); }
            set { CarregaDadosTela(value); }
        }

        private EmailVO RecolheDadosTela()
        {
            EmailVO retorno = new EmailVO();
            retorno.Email = TXT_email.Text;
            retorno.Newsletter = CHK_newsletter.Checked;
            retorno.EmailPreferencial = CHK_Preferencial.Checked;

            return retorno;
        }

        private void CarregaDadosTela(EmailVO value)
        {
            TXT_email.Text = value.Email;
            CHK_newsletter.Checked = value.Newsletter;
            CHK_Preferencial.Checked = value.EmailPreferencial;
        }

        public void LimparCampos()
        {
            TXT_email.ClearUndo();
            CHK_newsletter.Checked = false;
            CHK_Preferencial.Checked = false;
           
        }
#endregion

        private void CHK_newsletter_CheckedChanged(object sender, EventArgs e)
        {
                CHK_newsletter.Enabled = false;
           
        }

        private void CHK_Preferencial_CheckedChanged(object sender, EventArgs e)
        {
            CHK_Preferencial.Enabled = false;
            
        }
        public void HabilitaCheckNewsletter(bool valor)
        {
            CHK_newsletter.Enabled = valor;
        }
        public void HabilitaCheckPreferencial(bool valor)
        {
            CHK_Preferencial.Enabled = valor;
        }
        public void HabilitaCheckBox(bool valor)
        {
            this.HabilitaCheckNewsletter(valor);
            this.HabilitaCheckPreferencial(valor);
        }

        public bool retornaStatusCheck()
        {
            if (!CHK_newsletter.Checked ||!CHK_Preferencial.Checked)
            {
                return false;
            }
            else 
                return false;
        }



    }
}
